package com.example.kotlinstudy.test

import java.lang.Exception

//密封类
sealed class Result
class Success(val mag:String):Result()
class Failure(val err:Exception):Result()

fun getResultMsg(result: Result) = when(result){
    is Success ->result.mag
    is Failure ->result.err.message

}